package com.example.avmanagerweb.controller;



import com.example.avmanagerweb.redisService.RedisService;
import com.example.avmanagerweb.result.RLIST;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/text")
public class HelloController {

    @Autowired
    private RedisService redisService;
//================================文件模块===============================================


//    @LocalLock(key = "user:arg[0]")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public RLIST getFileList() {
        // get方式调用接口
        return RLIST.ok().data("data",1231);
    }

    //    @LocalLock(key = "user:arg[0]")
    @RequestMapping(value = "/list2", method = RequestMethod.GET)
    public RLIST getredis(@RequestParam("key") String key, @RequestParam("value") String value) {
        //
        System.out.println("123ok");
        redisService.setTokenValue2(key,10,value);
        return RLIST.ok();
    }

    //    @LocalLock(key = "user:arg[0]")
    @RequestMapping(value = "/list3", method = RequestMethod.GET)
    public RLIST getredis2(@RequestParam("key") String key) {
        //
        Object ok = redisService.getValue(key);
        System.out.println(ok);
        long tokenDate = redisService.getTokenDate(key);
        System.out.println(tokenDate);
        return RLIST.ok().data("d",ok);
    }

}